package cn.com.sparkle.paxos.net;

import java.util.Set;

import com.google.protobuf.GeneratedMessage;

public class MajorSender {
	public static void sendToMajor(Set<NetNode> activeNodes,
			GeneratedMessage request, CallBack callback) {
		for (NetNode n : activeNodes) {
			n.write(request, callback);
		}
	}

	public static void sendToMajorExceptSelf(Set<NetNode> activeNodes,
			GeneratedMessage request, CallBack callback, String address) {
		for (NetNode n : activeNodes) {
			if (!n.nodeState.getAddress().equals(address)) {
				n.write(request, callback);
			}
		}
	}
}
